home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
tipi
/
batmenu.tpi
< prev
next >
Wrap
Text File
|
1993-11-06
|
842b
|
50 lines
# Displays a batch menu
# and runs the chosen function
# by Kent Peterson
defstr valid$
define waitforkey ( -- choice )
( valid$ -- )
27 chr$ +$ # Add the escape character to the end
0 cursor
begin
inkey$ ucase$ # valid$ key$
len instr *
dup
if dup drop$ endif drop$
until
1 cursor
enddef
cls
command$
parse$ drop$
parse$ swap$ drop$
dup$ "" =$ if "Usage: BATMENU menufile" print$ 1 bye endif
"I" swap$ 1 open
1 isinput
"" valid$ store
begin
get$ parse$ dup$ "" =$
if 1 drop$ drop$
else 0 valid$ fetch swap$ +$ valid$ store drop$
endif
until
begin
get$ error
dup if drop$ else print$ cr endif
until
valid$ fetch waitforkey
dup
1 0 filepos drop
"" do drop$ get$ loop
parse$ drop$
1 close
"O" "BATCMD.BAT" 1 open
1 isoutput
print$ cr lf
1 close
cls